<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>课程信息修改</title>
		<link href="<%=basePath%>js/calendar/skins/aqua/theme.css"
			rel="stylesheet" />
		<link href="<%=basePath%>js/validate/jquery.validate.css"
			rel="stylesheet" />
		<script type="text/javascript" src="<%=basePath%>js/jquery-1.4.2.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>js/validate/messages_cn.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>js/validate/jquery.validate.js"></script>
		<script type="text/javascript" charset="UTF-8"
			src="<%=basePath%>js/validate/messages_cn.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>js/calendar/calendar.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>js/calendar/calendar-setup.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>js/calendar/lang/calendar-en.js"></script>

		<script type="text/javascript">
			$(function() {
				$("#subjectForm").validate( {
					rules : {
						"subject.subName" : {
							required : true,
							maxlength : 255
						},
						"subject.hours" : {
							required : true
						},
						"subject.timesWeek" : {
							required : true,
							maxlength : 2,
							digits : true
						},
						"subject.memo" : {
							maxlength : 255
						}
					}
				})
			});
		</script>
	</head>

	<body bgcolor="#D6E0EF">
		<div align="center">
			<form id="subjectForm" method="post"
				action="updateInfo!updateSubjectInfo">
				<table align="center">
					<s:iterator value="subject" var="subject">
						<tr>
							<td>
								课程名称：
							</td>
							<td align="left">
								<input type="text" name="subject.subName" id="subject.subName"
									value="<s:property value="subName"/>" />
							</td>
						</tr>
						<tr>
							<td>
								课时：
							</td>
							<td align="left">
								<input type="text" name="subject.hours" id="subject.hours"
									value="<s:property value="hours"/>" readonly="readonly" />
							</td>
							<td>
								<img id="dateTime"
									src="<%=basePath%>js/calendar/skins/aqua/cal.gif"
									style="cursor: pointer;" />
							</td>
						</tr>
						<tr>
							<td>
								课室：
							</td>
							<td align="left">
								<select name="classroomInfo.id" id="classroomInfo.id">
									<s:iterator value="arrangeList" var="classroom">
										<s:if test="arrange.id==id">
											<option value="<s:property value="id"/>" selected="selected">
												<s:property value="classRoom" />
											</option>
										</s:if>
										<s:else>
											<option value="<s:property value="id"/>">
												<s:property value="classRoom" />
											</option>
										</s:else>
									</s:iterator>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								班级：
							</td>
							<td align="left">
								<select name="classInfo.id" id="classInfo.id">
									<s:iterator value="classInfoList">
										<s:if test="classInfo.id==id">
											<option value="<s:property value="id"/>" selected="selected">
												<s:property value="className" />
											</option>
										</s:if>
										<s:else>
											<option value="<s:property value="id"/>">
												<s:property value="className" />
											</option>
										</s:else>
									</s:iterator>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								周期数：
							</td>
							<td align="left">
								<input type="text" name="subject.timesWeek"
									id="subject.timesWeek" value="<s:property value="timesWeek"/>" />
							</td>
						</tr>
						<tr>
							<td>
								课程类型：
							</td>
							<td align="left">
								<select name="subject.typeId" id="subject.typeId">
									<s:if test="typeId==1">
										<option value="0">
											必修
										</option>
										<option value="1" selected="selected">
											选修
										</option>
									</s:if>
									<s:else>
										<option value="0" selected="selected">
											必修
										</option>
										<option value="1">
											选修
										</option>
									</s:else>
								</select>
							</td>
						</tr>
						<tr>
							<td>
								备注：
							</td>
							<td align="left">
								<input type="text" name="subject.memo" id="subject.memo"
									value="<s:property value="memo"/>" />
							</td>
						</tr>
						<tr>
							<td>
								<input type="hidden" name="subject.id" id="subject.id"
									value="<s:property value="id" />" />
							</td>
						</tr>
					</s:iterator>
					<tr>
						<td></td>
						<td>
							<input type="reset" name="button" id="button" value="重置" />
							<input type="submit" name="button" id="button" value="更新数据" />
						</td>
					</tr>
				</table>
			</form>
		</div>
		<script type="text/javascript">
	Calendar.setup( {
		inputField : "subject.hours",
		ifFormat : "%Y-%m-%d",
		showsTime : "true",
		button : "dateTime",
		step : 1
	});
</script>
	</body>
</html>
